﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ServiceModel;
using System.ServiceModel.Channels;
using System.ServiceModel.Description;
using System.ServiceModel.Dispatcher;
using System.ServiceModel.Web;
using Obra.SmugMug.Api;
using System.Management.Automation;
using System.Security;
using System.Runtime.InteropServices;
using Obra.Common;

namespace Obra.PowerShell.SmugMug
{
    internal class SmugMugClientServiceProvider :
        ClientBase<ISmugMugClient>,
        IDisposable,
        ISmugMugClientService
    {
        private const int MAX_RECEIVED_MESSAGE_SIZE = 10 * 1024 * 1024; // 10 MB

        /// <summary>
        /// Get the binding for the Smugmug provider.
        /// </summary>
        /// <returns>
        /// WebHttpBinding with an increased received message size.
        /// </returns>
        /// <remarks>
        /// <para>
        /// SmugMug XML data can be very large, so increase the size to 10 MB 
        /// from the default of 64 KB.
        /// </para>
        /// <para>
        /// XXX: This value can be controlled in the app.config, and should be.
        /// </para>
        /// </remarks>
        private static Binding GetBinding()
        {
            WebHttpBinding binding = new WebHttpBinding()
            {
                MaxReceivedMessageSize = SmugMugClientServiceProvider.MAX_RECEIVED_MESSAGE_SIZE,
            };

            return binding;
        }

        private Obra.Api.ISession session;
        private readonly PSCredential credential;

        /// <summary>
        /// c-tor
        /// </summary>
        /// <param name="binding"></param>
        /// <param name="endpointAddress"></param>
        public SmugMugClientServiceProvider(
            PSCredential credential,
            EndpointAddress endpointAddress)
            : base(SmugMugClientServiceProvider.GetBinding(), endpointAddress)
        {
            this.credential = credential;

            this.Endpoint.Behaviors.Add(
              new EndpointBehavior());

            this.Endpoint.Behaviors.Add(
                new WebHttpBehavior());
        }

        public Obra.Api.ISession Session
        {
            get { return this.session; }
        }

        #region ISmugMugProvider Members

        /// <summary>
        /// Log on to SmugMug.
        /// </summary>
        public void LogOn()
        {
            string password = Credential.SecureStringToString(this.credential.Password);

            this.ClientCredentials.UserName.UserName = this.credential.UserName;
            this.ClientCredentials.UserName.Password = password;

            LoginWithPasswordContract contract = this.Channel.LoginWithPassword(
                this.credential.UserName,
                password,
                Strings.ApiKey);

            this.session = (Obra.Api.ISession)contract;
        }

        /// <summary>
        /// Log off from SmugMug.
        /// </summary>
        public void LogOff()
        {
            this.Channel.Logout(
                this.session.SessionId);
        }

        /// <summary>
        /// Convenience method to construct an Album from an AlbumContract.
        /// </summary>
        private Album CreateAlbum(
            AlbumContract albumContract)
        {
            return new Album(
                albumContract,
                this.session,
                (ISmugMugClient)this.Channel);
        }

        /// <summary>
        /// Convenience method to construct an Image from an ImageContract.
        /// </summary>w
        private Image CreateImage(
            ImageContract imageContract,
            int albumId)
        {
            return new Image(
                imageContract,
                this.session,
                (ISmugMugClient)this.Channel);
        }

        #endregion

        #region IDisposable Members

        void IDisposable.Dispose()
        {
            if (this.session != null)
            {
                this.LogOff();
            }
        }

        #endregion

        #region ISmugMugAlbums Members w/o sessionId

        public void CreateAlbum(string title, int categoryId)
        {
            this.CreateAlbum(this.session.SessionId, title, categoryId);
        }

        public void DeleteAlbum(int albumId)
        {
            this.DeleteAlbum(this.session.SessionId, albumId);
        }

        public AlbumsContract GetAlbums()
        {
            return this.GetAlbums(this.session.SessionId);
        }

        public AlbumContract GetAlbumInfo(int albumId)
        {
            return this.GetAlbumInfo(albumId);
        }

        public AlbumStat GetAlbumStats(int albumId, int month, int year)
        {
            return this.GetAlbumStats(this.session.SessionId, albumId, month, year);
        }

        public void SortAlbum(int albumId, string by, string direction)
        {
            this.SortAlbum(this.session.SessionId, albumId, by, direction);
        }

        #endregion w/o sessionId

        #region ISmugMugAlbumTemplates Members w/o sessionId

        public List<AlbumTemplateContract> GetAlbumTemplates()
        {
            return this.GetAlbumTemplates(this.session.SessionId);
        }

        #endregion

        #region ISmugMugCategories Members w/o sessionId

        public List<CategoryContract> GetCategories()
        {
            return this.GetCategories(this.session.SessionId);
        }

        public void CategoryCreate(string name)
        {
            this.CreateCategory(this.session.SessionId, name);
        }

        public void CategoryDelete(int categoryId)
        {
            this.DeleteCategory(this.session.SessionId, categoryId);
        }

        public void CategoryRename(int categoryId, string name)
        {
            this.RenameCategory(this.session.SessionId, categoryId, name);
        }

        #endregion

        #region ISmugMugImages Members w/o sessionId

        public void DeleteImage(int imageId)
        {
            this.DeleteImage(this.session.SessionId, imageId);
        }

        public ImagesContract GetImages(int albumId)
        {
            return this.GetImages(this.session.SessionId, albumId);
        }

        public ImageExif GetImageExif(int imageId)
        {
            return this.GetImageExif(this.session.SessionId, imageId);
        }

        public ImageContract GetImageInfo(int imageId)
        {
            return this.GetImageInfo(this.session.SessionId, imageId);
        }

        public ImageUrls GetImageUrls(int imageId, int templateId)
        {
            return this.GetImageUrls(this.session.SessionId, imageId, templateId);
        }

        #endregion

        #region ISmugMugAlbumsChangeSettings Members w/o sessionId

        public void ChangeAlbumBackprinting(int albumId, string backPrinting)
        {
            this.ChangeAlbumBackprinting(this.session.SessionId, albumId, backPrinting);
        }

        public void ChangeAlbumCanRank(int albumId, bool canRank)
        {
            this.ChangeAlbumCanRank(this.session.SessionId, albumId, canRank);
        }

        public void ChangeAlbumCategoryId(int albumId, int categoryId)
        {
            this.ChangeAlbumCategoryId(this.session.SessionId, albumId, categoryId);
        }

        public void ChangeAlbumClean(int albumId, bool clean)
        {
            this.ChangeAlbumClean(this.session.SessionId, albumId, clean);
        }

        public void ChangeAlbumColorCorrection(int albumId, int colorCorrection)
        {
            this.ChangeAlbumColorCorrection(this.session.SessionId, albumId, colorCorrection);
        }

        public void ChangeAlbumComments(int albumId, bool comments)
        {
            this.ChangeAlbumComments(this.session.SessionId, albumId, comments);
        }

        public void ChangeAlbumCommunityId(int albumId, int communityId)
        {
            this.ChangeAlbumCommunityId(this.session.SessionId, albumId, communityId);
        }

        public void ChangeAlbumDefaultColor(int albumId, bool defaultColor)
        {
            this.ChangeAlbumDefaultColor(this.session.SessionId, albumId, defaultColor);
        }

        public void ChangeAlbumDescription(int albumId, string description)
        {
            this.ChangeAlbumDescription(this.session.SessionId, albumId, description);
        }

        public void ChangeAlbumExif(int albumId, bool exif)
        {
            this.ChangeAlbumExif(this.session.SessionId, albumId, exif);
        }

        public void ChangeAlbumExternal(int albumId, bool external)
        {
            this.ChangeAlbumExternal(this.session.SessionId, albumId, external);
        }

        public void ChangeAlbumFamilyEdit(int albumId, bool familyEdit)
        {
            this.ChangeAlbumFamilyEdit(this.session.SessionId, albumId, familyEdit);
        }

        public void ChangeAlbumFileNames(int albumId, bool fileNames)
        {
            this.ChangeAlbumFileNames(this.session.SessionId, albumId, fileNames);
        }

        public void ChangeAlbumFriendEdit(int albumId, bool friendEdit)
        {
            this.ChangeAlbumFriendEdit(this.session.SessionId, albumId, friendEdit);
        }

        public void ChangeAlbumGeography(int albumId, bool geography)
        {
            this.ChangeAlbumGeography(this.session.SessionId, albumId, geography);
        }

        public void ChangeAlbumHeader(int albumId, bool header)
        {
            this.ChangeAlbumHeader(this.session.SessionId, albumId, header);
        }

        public void ChangeAlbumHideOwner(int albumId, bool hideOwner)
        {
            this.ChangeAlbumHideOwner(this.session.SessionId, albumId, hideOwner);
        }

        public void ChangeAlbumHighlightId(int albumId, int highlightId)
        {
            this.ChangeAlbumHighlightId(this.session.SessionId, albumId, highlightId);
        }

        public void ChangeAlbumKeywords(int albumId, string keywords)
        {
            this.ChangeAlbumKeywords(this.session.SessionId, albumId, keywords);
        }

        public void ChangeAlbumLarges(int albumId, bool larges)
        {
            this.ChangeAlbumLarges(this.session.SessionId, albumId, larges);
        }

        public void ChangeAlbumOriginals(int albumId, bool originals)
        {
            this.ChangeAlbumOriginals(this.session.SessionId, albumId, originals);
        }

        public void ChangeAlbumPassword(int albumId, string password)
        {
            this.ChangeAlbumPassword(this.session.SessionId, albumId, password);
        }

        public void ChangeAlbumPasswordHint(int albumId, string passwordHint)
        {
            this.ChangeAlbumPasswordHint(this.session.SessionId, albumId, passwordHint);
        }

        public void ChangeAlbumPosition(int albumId, int position)
        {
            this.ChangeAlbumPosition(this.session.SessionId, albumId, position);
        }

        public void ChangeAlbumPrintable(int albumId, bool printable)
        {
            this.ChangeAlbumPrintable(this.session.SessionId, albumId, printable);
        }

        public void ChangeAlbumProofDays(int albumId, int proofDays)
        {
            this.ChangeAlbumProofDays(this.session.SessionId, albumId, proofDays);
        }

        public void ChangeAlbumProtected(int albumId, bool @protected)
        {
            this.ChangeAlbumProtected(this.session.SessionId, albumId, @protected);
        }

        public void ChangeAlbumPublic(int albumId, bool @public)
        {
            this.ChangeAlbumPublic(this.session.SessionId, albumId, @public);
        }

        public void ChangeAlbumShare(int albumId, bool share)
        {
            this.ChangeAlbumShare(this.session.SessionId, albumId, share);
        }

        public void ChangeAlbumSmugSearchable(int albumId, bool smugSearchable)
        {
            this.ChangeAlbumSmugSearchable(this.session.SessionId, albumId, smugSearchable);
        }

        public void ChangeAlbumSortDirection(int albumId, bool sortDirection)
        {
            this.ChangeAlbumSortDirection(this.session.SessionId, albumId, sortDirection);
        }

        public void ChangeAlbumSortMethod(int albumId, string sortMethod)
        {
            this.ChangeAlbumSortMethod(this.session.SessionId, albumId, sortMethod);
        }

        public void ChangeAlbumSubCategoryId(int albumId, int subCategoryId)
        {
            this.ChangeAlbumSubCategoryId(this.session.SessionId, albumId, subCategoryId);
        }

        public void ChangeAlbumTemplateId(int albumId, int templateId)
        {
            this.ChangeAlbumTemplateId(this.session.SessionId, albumId, templateId);
        }

        public void ChangeAlbumTitle(int albumId, string title)
        {
            this.ChangeAlbumTitle(this.session.SessionId, albumId, title);
        }

        public void ChangeAlbumUnsharpAmount(int albumId, float unsharpAmount)
        {
            this.ChangeAlbumUnsharpAmount(this.session.SessionId, albumId, unsharpAmount);
        }

        public void ChangeAlbumUnsharpRadius(int albumId, float unsharpRadius)
        {
            this.ChangeAlbumUnsharpRadius(this.session.SessionId, albumId, unsharpRadius);
        }

        public void ChangeAlbumUnsharpSigma(int albumId, float unsharpSigma)
        {
            this.ChangeAlbumUnsharpSigma(this.session.SessionId, albumId, unsharpSigma);
        }

        public void ChangeAlbumUnsharpThreshold(int albumId, float unsharpThreshold)
        {
            this.ChangeAlbumUnsharpThreshold(this.session.SessionId, albumId, unsharpThreshold);
        }

        public void ChangeAlbumWatermarking(int albumId, bool watermarking)
        {
            this.ChangeAlbumWatermarking(this.session.SessionId, albumId, watermarking);
        }

        // TODO: change WatermarkId to watermarkId in the interface
        public void ChangeAlbumWatermarkId(int albumId, int watermarkId)
        {
            this.ChangeAlbumWatermarkId(this.session.SessionId, albumId, watermarkId);
        }

        public void ChangeAlbumWorldSearchable(int albumId, bool worldSearchable)
        {
            this.ChangeAlbumWorldSearchable(this.session.SessionId, albumId, worldSearchable);
        }

        public void ChangeAlbumXLarges(int albumId, bool xLarges)
        {
            this.ChangeAlbumXLarges(this.session.SessionId, albumId, xLarges);
        }

        public void ChangeAlbumX2Larges(int albumId, bool x2Larges)
        {
            this.ChangeAlbumX2Larges(this.session.SessionId, albumId, x2Larges);
        }

        public void ChangeAlbumX3Larges(int albumId, bool x3Larges)
        {
            this.ChangeAlbumX3Larges(this.session.SessionId, albumId, x3Larges);
        }

        #endregion

        #region ISmugMugImagesChangeSettings Members w/o sessionId

        public void ChangeImageAlbum(int imageId, int albumId)
        {
            this.Channel.ChangeImageAlbum(this.session.SessionId, imageId, albumId);
        }

        public void ChangeImageCaption(int imageId, string caption)
        {
            this.Channel.ChangeImageCaption(this.session.SessionId, imageId, caption);
        }

        public void ChangeImageHidden(int imageId, bool hidden)
        {
            this.Channel.ChangeImageHidden(this.session.SessionId, imageId, hidden);
        }

        public void ChangeImageKeywords(int imageId, string keywords)
        {
            this.Channel.ChangeImageKeywords(this.session.SessionId, imageId, keywords);
        }

        // TODO: qualify this method Image blah, blah, blah
        public void ChangeImagePosition(int imageId, int position)
        {
            this.Channel.ChangeImagePosition(this.session.SessionId, imageId, position);
        }

        #endregion

        #region ISmugMugAlbums Members

        public void ChangeAlbumSettings(string sessionId, int albumId, int categoryId, int subCategoryId, int communityId, int highlightId, string description, string keywords, string password, string passwordHint, int position, string sortMethod, bool sortDirection, bool @public, bool fileNames, bool comments, bool external, bool exif, bool share, bool printable, bool originals, bool familyEdit, bool friendEdit, bool hideOwner, bool header, int templateId, bool larges, bool xlarges, bool x2Larges, bool x3Larges, bool defaultColor, bool clean, bool @protected, bool watermarking, int proofDays, string backprinting, bool smugSearchable, bool worldSearchable, float unsharpAmount, float unsharpRadius, float unsharpThreshold, float unsharpSigma)
        {
            throw new NotImplementedException();
        }

        public void CreateAlbum(string sessionId, string title, int categoryId)
        {
            this.Channel.CreateAlbum(sessionId, title, categoryId);
        }

        public void DeleteAlbum(string sessionId, int albumId)
        {
            this.Channel.DeleteAlbum(sessionId, albumId);
        }

        public AlbumsContract GetAlbums(string sessionId)
        {
            return this.Channel.GetAlbums(sessionId);
        }

        public AlbumContract GetAlbumInfo(string sessionId, int albumId)
        {
            return this.Channel.GetAlbumInfo(sessionId, albumId);
        }

        public AlbumStat GetAlbumStats(string sessionId, int albumId, int month, int year)
        {
            return this.Channel.GetAlbumStats(sessionId, albumId, month, year);
        }

        public void SortAlbum(string sessionId, int albumId, string by, string direction)
        {
            this.Channel.SortAlbum(sessionId, albumId, by, direction);
        }

        #endregion

        #region ISmugMugAlbumTemplates Members

        public List<AlbumTemplateContract> GetAlbumTemplates(string sessionId)
        {
            return this.Channel.GetAlbumTemplates(sessionId);
        }

        #endregion

        #region ISmugMugCategories Members

        public List<CategoryContract> GetCategories(string sessionId)
        {
            return this.Channel.GetCategories(sessionId);
        }

        public void CreateCategory(string sessionId, string name)
        {
            this.Channel.CreateCategory(sessionId, name);
        }

        public void DeleteCategory(string sessionId, int categoryId)
        {
            this.Channel.DeleteCategory(sessionId, categoryId);
        }

        public void RenameCategory(string sessionId, int categoryId, string name)
        {
            this.Channel.RenameCategory(sessionId, categoryId, name);
        }

        #endregion

        #region ISmugMugImages Members

        public void ChangeImageSettings(string sessionId, int albumId, int imageId, string caption, string keywords, bool hidden)
        {
            throw new NotImplementedException();
        }

        public void DeleteImage(string sessionId, int imageId)
        {
            this.Channel.DeleteImage(sessionId, imageId);
        }

        public ImagesContract GetImages(string sessionId, int albumId)
        {
            return this.Channel.GetImages(sessionId, albumId);
        }

        public ImageExif GetImageExif(string sessionId, int imageId)
        {
            return this.Channel.GetImageExif(sessionId, imageId);
        }

        public ImageContract GetImageInfo(string sessionId, int imageId)
        {
            return this.Channel.GetImageInfo(sessionId, imageId);
        }

        public ImageUrls GetImageUrls(string sessionId, int imageId, int templateId)
        {
            return this.Channel.GetImageUrls(sessionId, imageId, templateId);
        }

        public void UploadFromUrl(string sessionId, int albumId, string caption, Uri url, string keywords, string latitude, string longitude, string altitude, int byteCount, string md5Sum)
        {
            throw new NotImplementedException();
        }

        #endregion

        #region ISmugMugSession Members

        public LoginWithPasswordContract LoginWithPassword(string emailAddress, string password, string apiKey)
        {
            throw new NotImplementedException();
        }

        public void Logout(string sessionId)
        {
            throw new NotImplementedException();
        }

        #endregion

        #region ISmugMugAlbumsChangeSettings Members

        public void ChangeAlbumBackprinting(string sessionId, int albumId, string backPrinting)
        {
            this.Channel.ChangeAlbumBackprinting(sessionId, albumId, backPrinting);
        }

        public void ChangeAlbumCanRank(string sessionId, int albumId, bool canRank)
        {
            this.Channel.ChangeAlbumCanRank(sessionId, albumId, canRank);
        }

        public void ChangeAlbumCategoryId(string sessionId, int albumId, int categoryId)
        {
            this.Channel.ChangeAlbumCategoryId(sessionId, albumId, categoryId);
        }

        public void ChangeAlbumClean(string sessionId, int albumId, bool clean)
        {
            this.Channel.ChangeAlbumClean(sessionId, albumId, clean);
        }

        public void ChangeAlbumColorCorrection(string sessionId, int albumId, int colorCorrection)
        {
            this.Channel.ChangeAlbumColorCorrection(sessionId, albumId, colorCorrection);
        }

        public void ChangeAlbumComments(string sessionId, int albumId, bool comments)
        {
            this.Channel.ChangeAlbumComments(sessionId, albumId, comments);
        }

        public void ChangeAlbumCommunityId(string sessionId, int albumId, int communityId)
        {
            this.Channel.ChangeAlbumCommunityId(sessionId, albumId, communityId);
        }

        public void ChangeAlbumDefaultColor(string sessionId, int albumId, bool defaultColor)
        {
            this.Channel.ChangeAlbumDefaultColor(sessionId, albumId, defaultColor);
        }

        public void ChangeAlbumDescription(string sessionId, int albumId, string description)
        {
            this.Channel.ChangeAlbumDescription(sessionId, albumId, description);
        }

        public void ChangeAlbumExif(string sessionId, int albumId, bool exif)
        {
            this.Channel.ChangeAlbumExif(sessionId, albumId, exif);
        }

        public void ChangeAlbumExternal(string sessionId, int albumId, bool external)
        {
            this.Channel.ChangeAlbumExternal(sessionId, albumId, external);
        }

        public void ChangeAlbumFamilyEdit(string sessionId, int albumId, bool familyEdit)
        {
            this.Channel.ChangeAlbumFamilyEdit(sessionId, albumId, familyEdit);
        }

        public void ChangeAlbumFileNames(string sessionId, int albumId, bool fileNames)
        {
            this.Channel.ChangeAlbumFileNames(sessionId, albumId, fileNames);
        }

        public void ChangeAlbumFriendEdit(string sessionId, int albumId, bool friendEdit)
        {
            this.Channel.ChangeAlbumFriendEdit(sessionId, albumId, friendEdit);
        }

        public void ChangeAlbumGeography(string sessionId, int albumId, bool geography)
        {
            this.Channel.ChangeAlbumGeography(sessionId, albumId, geography);
        }

        public void ChangeAlbumHeader(string sessionId, int albumId, bool header)
        {
            this.Channel.ChangeAlbumHeader(sessionId, albumId, header);
        }

        public void ChangeAlbumHideOwner(string sessionId, int albumId, bool hideOwner)
        {
            this.Channel.ChangeAlbumHideOwner(sessionId, albumId, hideOwner);
        }

        public void ChangeAlbumHighlightId(string sessionId, int albumId, int highlightId)
        {
            this.Channel.ChangeAlbumHighlightId(sessionId, albumId, highlightId);
        }

        public void ChangeAlbumKeywords(string sessionId, int albumId, string keywords)
        {
            this.Channel.ChangeAlbumKeywords(sessionId, albumId, keywords);
        }

        public void ChangeAlbumLarges(string sessionId, int albumId, bool larges)
        {
            this.Channel.ChangeAlbumLarges(sessionId, albumId, larges);
        }

        public void ChangeAlbumOriginals(string sessionId, int albumId, bool originals)
        {
            this.Channel.ChangeAlbumOriginals(sessionId, albumId, originals);
        }

        public void ChangeAlbumPassword(string sessionId, int albumId, string password)
        {
            this.Channel.ChangeAlbumPassword(sessionId, albumId, password);
        }

        public void ChangeAlbumPasswordHint(string sessionId, int albumId, string passwordHint)
        {
            this.Channel.ChangeAlbumPasswordHint(sessionId, albumId, passwordHint);
        }

        public void ChangeAlbumPosition(string sessionId, int albumId, int position)
        {
            this.Channel.ChangeAlbumPosition(sessionId, albumId, position);
        }

        public void ChangeAlbumPrintable(string sessionId, int albumId, bool printable)
        {
            this.Channel.ChangeAlbumPrintable(sessionId, albumId, printable);
        }

        public void ChangeAlbumProofDays(string sessionId, int albumId, int proofDays)
        {
            this.Channel.ChangeAlbumProofDays(sessionId, albumId, proofDays);
        }

        public void ChangeAlbumProtected(string sessionId, int albumId, bool @protected)
        {
            this.Channel.ChangeAlbumProtected(sessionId, albumId, @protected);
        }

        public void ChangeAlbumPublic(string sessionId, int albumId, bool @public)
        {
            this.Channel.ChangeAlbumPublic(sessionId, albumId, @public);
        }

        public void ChangeAlbumShare(string sessionId, int albumId, bool share)
        {
            this.Channel.ChangeAlbumShare(sessionId, albumId, share);
        }

        public void ChangeAlbumSmugSearchable(string sessionId, int albumId, bool smugSearchable)
        {
            this.Channel.ChangeAlbumSmugSearchable(sessionId, albumId, smugSearchable);
        }

        public void ChangeAlbumSortDirection(string sessionId, int albumId, bool sortDirection)
        {
            this.Channel.ChangeAlbumSortDirection(sessionId, albumId, sortDirection);
        }

        public void ChangeAlbumSortMethod(string sessionId, int albumId, string sortMethod)
        {
            this.Channel.ChangeAlbumSortMethod(sessionId, albumId, sortMethod);
        }

        public void ChangeAlbumSubCategoryId(string sessionId, int albumId, int subCategoryId)
        {
            this.Channel.ChangeAlbumSubCategoryId(sessionId, albumId, subCategoryId);
        }

        public void ChangeAlbumTemplateId(string sessionId, int albumId, int templateId)
        {
            this.Channel.ChangeAlbumTemplateId(sessionId, albumId, templateId);
        }

        public void ChangeAlbumTitle(string sessionId, int albumId, string title)
        {
            this.Channel.ChangeAlbumTitle(sessionId, albumId, title);
        }

        public void ChangeAlbumUnsharpAmount(string sessionId, int albumId, float unsharpAmount)
        {
            this.Channel.ChangeAlbumUnsharpAmount(sessionId, albumId, unsharpAmount);
        }

        public void ChangeAlbumUnsharpRadius(string sessionId, int albumId, float unsharpRadius)
        {
            this.Channel.ChangeAlbumUnsharpRadius(sessionId, albumId, unsharpRadius);
        }

        public void ChangeAlbumUnsharpSigma(string sessionId, int albumId, float unsharpSigma)
        {
            this.Channel.ChangeAlbumUnsharpSigma(sessionId, albumId, unsharpSigma);
        }

        public void ChangeAlbumUnsharpThreshold(string sessionId, int albumId, float unsharpThreshold)
        {
            this.Channel.ChangeAlbumUnsharpThreshold(sessionId, albumId, unsharpThreshold);
        }

        public void ChangeAlbumWatermarking(string sessionId, int albumId, bool watermarking)
        {
            this.Channel.ChangeAlbumWatermarking(sessionId, albumId, watermarking);
        }

        public void ChangeAlbumWatermarkId(string sessionId, int albumId, int watermarkId)
        {
            this.Channel.ChangeAlbumWatermarkId(sessionId, albumId, watermarkId);
        }

        public void ChangeAlbumWorldSearchable(string sessionId, int albumId, bool worldSearchable)
        {
            this.Channel.ChangeAlbumWorldSearchable(sessionId, albumId, worldSearchable);
        }

        public void ChangeAlbumXLarges(string sessionId, int albumId, bool xLarges)
        {
            this.Channel.ChangeAlbumXLarges(sessionId, albumId, xLarges);
        }

        public void ChangeAlbumX2Larges(string sessionId, int albumId, bool x2Larges)
        {
            this.Channel.ChangeAlbumX2Larges(sessionId, albumId, x2Larges);
        }

        public void ChangeAlbumX3Larges(string sessionId, int albumId, bool x3Larges)
        {
            this.Channel.ChangeAlbumX3Larges(sessionId, albumId, x3Larges);
        }

        #endregion

        #region ISmugMugImagesChangeSettings Members

        public void ChangeImageAlbum(string sessionId, int imageId, int albumId)
        {
            this.Channel.ChangeImageAlbum(sessionId, imageId, albumId);
        }

        public void ChangeImageCaption(string sessionId, int imageId, string caption)
        {
            this.Channel.ChangeImageCaption(sessionId, imageId, caption);
        }

        public void ChangeImageHidden(string sessionId, int imageId, bool hidden)
        {
            this.Channel.ChangeImageHidden(sessionId, imageId, hidden);
        }

        public void ChangeImageKeywords(string sessionId, int imageId, string keywords)
        {
            this.Channel.ChangeImageKeywords(sessionId, imageId, keywords);
        }

        public void ChangeImagePosition(string sessionId, int imageId, int position)
        {
            this.Channel.ChangeImagePosition(sessionId, imageId, position);
        }
        
        #endregion
    }
}
